Final Project

Group 1:

  • Hiba Awan

  • Nathania Stephens

Abstract

Introduction & Background

Motivation/ Purpose

In 2023, there were over 30,000 arrests and close to 65,000 citations in Fairfax County. The Fairfax County boundaries, include areas such as Centreville, Chantilly, Herndon, Reston, Tysons Corner, McLean, Merrifield, George Mason, Annadale, Burke, Springfield, Alexandria, Lorton to name a few. If you live, work, or study in these areas then this project should be of interest to you. This project aims to inform Fairfax County patrons of crime information and hopefully provide some statistical insights that could be applicable.

Goals/ Objectives

In order to provide relevant and insightful crime information, several different visualization methods were applied to help easily interpret and compare data. Statistical learning techniques were utilized to help understand statistic significantly factors and associations between variables. Since the data utilized for this project is largely categorical the project focuses on techniques such as Chi-Squared Test, Logistic Regression, Decision Trees and Random Forest.

Data

Overview

About the Data

Three datasets were pulled from the Fairfax County Police Department website. They covered arrest, citations, and warnings in the year 2023. For simplicity, general definitions are provided:

  • Arrest - When a person is taken into custody to answer for an offense or when there is a deprivation or restraint of a person’s liberty in any significant way.

  • Citation - Formal notice issued by law enforcement officer for a violation of law, typically related to traffic laws or other minor offenses. Typically requiring a violator to appear in court or pay a fine.

  • Warning - When a violation, typically minor, has been made but an officer issues a warning rather than a citation.

The data sets included between 24 and 34 variables, but some of many of the variables were redundant or were not applicable to the research (e.g. web_address, phone_number, name). The following attributes were key to the research conducted:

Column Name Data Type Description
Date Date Date of Violation
Time Chr Time of Violation
Offense Chr Description of Violation
Gender Chr Gender of Violator
Ethnicity Chr Hispanic or Non-Hispanic
District Chr Administrative area
Latitude Dbl Coordinates measuring north/ south of equator
Longitude Dbl Coordinates measuring east/ west of prime meridian
Outcome Chr Result of violation, arrest, citation, or warning

Limitations and Assumptions

Due to the nature of the data available on the Fairfax County Police Department website, analysis was limited to qualitative techniques. The approach taken for the project focused on predicting through qualitative responses or classification. This means that each record pulled from the Fairfax County Police Department (FCPD) would be assigned to a category or class.

While understanding local crime is the goal of this project, the data acquired only accounts for crime that was recorded by FCPD. It does not take into account crimes that were not report or any other crime that was not reported through FCPD channels.

Cleaning and Transformation

To address questions related to gender, the data needed to be standardized and correctly categorized. Column names needed to be consistent across the three datasets to merge. Gender was used over Sex. Next the column data would be transformed to consistent labels, e.g. Male, Female, and Other/Unknown. Total proportion for Gender was examined, to verify that other/ unknown class could be removed without…

Research Questions

  1. Is there an association between gender and warnings?

  2. Are there other factors that determine if someone gets out of a “ticket”? OR Are you more likely to get a ticket at the end of the month (some believe that police officers have a monthly quota)

  3. How do enforcement outcomes vary across districts and demographic groups?

Research & Analysis

Question 1: Is there an association between gender and warnings?

To address this question the null and alternative hypothesis are established.

Null Hypothesis: There is no association between gender and violation outcome, warning or citation. This would mean that the likelihood of a violator getting a warning is independent of gender.

Alternative Hypothesis: There is an association between gender and violation outcome. This implies that gender affects the outcome of whether a violator is given a citation or warning.

According to the cleaned and combined dataset for warnings and citation, there was a total of 88,320 records. By looking at the counts for each outcome (citation or warning), there are a lot more citations than there are warnings given out by FCPD. This stacked bar chart also shows that males have a higher count for both categories.

Next, the warning rate for gender is calculated. This looks at the probability of a male or female violator receiving a Warning instead of a citation e.g. getting out of a ticket. To calculate warning rate, the number of warnings are divided by the total number of incidents. \[ \frac{\text{Number of Warnings}}{\text{Total Incidents (Warnings + Citations)}} \]

This shows a slight difference in proportion between the two genders, with females having a higher warning rate than males. In other words, females received more warnings than males. Is this difference significant or is it a result of chance or other factors? To help understand these results, the Chi-Square Test of Independence is used. The Chi-Square Test of Independence will help determine whether the variables, gender and outcome, are independent or if there is a relationship between them.

\[ \chi^2 = \sum \frac{(O-E)^2}{E} \] To implement the Chi-Square Test, a contingency table is generated, which shows the distribution for gender and outcome.

Gender Citations Warnings
Female 20,478 8,777
Male 43,657 15,408

The results of the Chi-Square test shows:

  • Chi-Square Statistic (x-squared): The chi-square test statistic is 150.62. This is the discrepancy between the observed frequencies, citations and warnings, and the expected frequencies if there were no association between the gender and outcome. This is demonstrated in the below tables.
Gender Expected Citations Observed Citations Expected Warnings Observed Warnings
Female 21,243 20,478 8,011 8,777
Male 42,891 43,657 16,173 15,408
  • Degrees of Freedom (df): The degree of freedom for this test is 1, which is the number of rows minus 1 multiplied by number of columns minus 1.

  • p-value: The p-value is 2.2e-16 which is much smaller than 0.05. This represents the probability of observing the chi-square statistic, 150.62, or more if the null hypothesis were true.

To visualize each value in the above table by its contribution to the chi-square test a heatmap is generated. This quickly shows which values have the highest contribution percentage.

Thus the null hypothesis is rejected. The results show that there is a statistically significant association between gender and violation outcome in Fairfax County. In other words, the Chi-square test indicates that the likelihood of a violation outcome is significantly associated with gender.

Another Questions….

To address each of these question, first exploratory analysis should be done to gain an understanding and summary of the crime metrics for Fairfax County. This includes understanding what type of crimes occurred the most and where.

General crime Mapping the arrest data for a geospatial visual of where arrest occur.

Next we look at the Top 10 Arrest Type by Incident Based Reporting (IBR) codes.

Next examining the Top 10 Citations

Warning Versus Citation Next an examination of warning versus citation will be observed… This will help understand what different factors could play into getting a warning or a citation.

Question 2: How Does Time and Location Factor into the Odds of a Citations?

For this research question, variables such as time of day, progression of week, day of month, and district are examined to determine if those variable influence an officer’s decision to issue a warning or citation. For this question, arrests are excluded since it is assumed a higher threshold of danger is imminent and would allow for less use of officers’ discretion.

First, to explore the likelihood of getting a citation versus a warning (outcome of a violation), the citation rate is calculated, using the following equation.

\[ \begin{align*} Citation Rate = \frac{\text{Number of Citations}}{\text{Total Incidents (Warnings + Citations)}} \end{align*} \]

Then, a heatmap is generated to see if there are any patterns that would indicate trends over hours of the day and throughout the month.

The higher intensity or darker color areas represent a higher citation rate. During the hours of 0500-0600 (24-hour clock) the citation rate is much higher across most days of the month. This would imply that officers are less likely to issue warnings between 5am and 6am. This time also aligns with morning rush hour and higher volumes of traffic are expected. However, the same pattern of higher citation rates are not observed during evening rush hour. The heatmap also does not show higher intensities during the end of the month. Which is what we would expect to see if officers were attempting to meet monthly ticket quotas at the end of the month.

To visualize citation and warnings geospatially, a map is generated using the latitude and longitude associated to each record. While this map is helpful for understanding concentrations of citations and warning. It is misleading in show the most dominate outcomes. This is likely due to the quantity of data points overlaid on one another; however, since it is interactive areas can be zoomed in on for further insight.

Reading layer `Supervisor_Districts' from data source 
  `/Users/hibaawan/Desktop/hiba/hma_website/Supervisor_Districts/Supervisor_Districts.shp' 
  using driver `ESRI Shapefile'
Simple feature collection with 9 features and 12 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 11757190 ymin: 6905421 xmax: 11899000 ymax: 7070364
Projected CRS: NAD83 / Virginia North (ftUS)

Next, through the use of Logistic Regression, the odds ratios is examined between citations and warnings for Fairfax county. Predictor variables, time of day, week progression, day of month, district are used to predict the probability that a warning or citation will occur. The results provide an odd ratios at the intercept of 0.532 which would indicate that the odds of getting a warning are less than 50/50. In other words, if pulled over for a traffic violation, it is not a flip of a coin whether you get a ticket or not. Your chance of getting a citation is higher according to the intercept generated through this logistic regression model. Additionally, the model showed factors that did increased the likelihood of getting a warning occurred in certain districts (Mount Vernon, Mason, and Franconia) and progression of the week influences leniency. In weekly progression, an odds ratio of 1.595 shows that as the week progresses from Monday to Sunday, the odds of recieving a warning increase by 59.5 %. Alternatively, factors such as time of day and day of the month showed an increased likelihood of a citation. Using the below graph, the top five odds ratio for citation and bottom five odds ratio for warnings are depicted.

Gender and race were originally included but removed to isolate only time and space variables. Additionally, after running both models, the Area Under the Curve (AUC) increased only slightly (+ 0.0004) after removal of race and gender. This would mean that while gender and race were statistically significant, they were not as strong of predictors as date/time and district when classifying an outcome of either citation or warning. The AUC for the model that focused date/time and district was 0.6289. Which means that 63% of the citation/warning outcome is predictable using day of the month, time of day, progression of week, and district. The other 37% of the outcome is due to other factors not captured in this model. These factors could include offense type, violator’s behavior, and officer variables. While not a particularly strong predictive model, the model helps understand the effects of time and location.

Question 3: How do enforcement outcomes vary across districts and demographic groups?

Finally, we’ll be exploring the relationships between the outcomes of crime incidents and their district and demographic (gender, race, ethnicity) variables. Addressing this final question involved combining the three data sets of different crime outcomes: arrest data, citation data, and warning data.

Starting with the outcomes across different districts, we start off by performing a chi-square test to establish whether there’s a relationship between the crime outcomes and the districts they took place in.

Null Hypothesis: Enforcement outcome is independent of police district.

Alternative hypothesis: Enforcement outcome and police district are associated.

For the chi-square implementation, a contingency table for the district and outcome counts is generated:

              
               Arrest Citation Warning
  BRADDOCK       1221     7647    2645
  DRANESVILLE     881     5055    2088
  FRANCONIA      6011     6534    3499
  HUNTER MILL    2001     6244    2474
  MASON          5833     5490    2678
  MOUNT VERNON   3040     3662    2451
  PROVIDENCE     9315     4772    1941
  SPRINGFIELD    1176     9909    2672
  SULLY          2300    14854    3758
  Unverified      356     1127     154

From both the visualization above and the table output, we can see that citations are the most common outcome among the districts. However, this won’t affect the test as chi-square allows unequal margin totals and, in this case, is testing the distribution of outcomes across districts. The other outcomes, arrests and warnings, vary substantially in volume across districts. Some districts (like Sully, Springfield, Providence) show particularly high citation counts, while others (Braddock, Dranesville) show lower overall enforcement volumes.

Then the test is performed:


    Pearson's Chi-squared test

data:  table(combined_data$District, combined_data$Outcome)
X-squared = 20692, df = 18, p-value < 2.2e-16

The chi-square statistic is extremely large, which indicates a substantial deviation between observed and expected counts. The p-value is also low enough that we reject the null hypothesis. This means enforcement outcomes (arrests, citations, and warnings) are not distributed uniformly across police districts. Therefore, there is a statistically significant association between district and enforcement outcome.

From this, we can see that enforcement severity varies by district and district-level patterns justify further modeling.

Doing some pre-analysis on race, ethnicity, and gender shows that exploring the distribution of enforcement outcomes across demographic variables is worth pursuing as well.

In order to test both the district and demographic variables affects, below we perform logistic regression:

# weights:  69 (44 variable)
initial  value 133797.793412 
iter  10 value 110273.346261
iter  20 value 109828.994978
iter  30 value 108047.740898
iter  40 value 106985.637011
iter  50 value 106983.922418
final  value 106983.911647 
converged

The results below are done with arrest as the reference outcome, so the coefficients are relative to the arrest outcome.

Race: In terms of reference A (asian), Black individuals have lower odds of receiving a citation or warning vs arrest. Not to the same extent, but the same applies to white individuals as well.

Gender: In terms of reference F (female), males have lower odds of receiving a citations or warning vs arrest.

Ethnicity: Variable only really indicates hispanic or non-hispanic, so in terms of this, hispanic individuals have lower odds of receiving a citation or ticket vs arrest.

District: Mason, Providence, Franconia, Hunter Mill, and Sully individuals have a lower odds of receiving citations/warnings than arrests.

Call:
multinom(formula = Outcome ~ Race + Gender + District + Ethnicity, 
    data = combined_data)

Coefficients:
         (Intercept)     RaceB    RaceI    RaceU      RaceW    GenderM
Citation    6.446043 -1.270532 1.902943 2.020289 -0.1401901 -0.5121848
Warning    -2.979146 -1.162020 1.981047 1.571784 -0.0923412 -0.6626383
           GenderO  GenderU  GenderX DistrictDRANESVILLE DistrictFRANCONIA
Citation  6.010004 7.558657 9.927126          -0.0666923         -1.475278
Warning  -4.276199 9.096641 8.356495           0.1233499         -1.022930
         DistrictHUNTER MILL DistrictMASON DistrictMOUNT VERNON
Citation          -0.6712792     -1.629807           -1.3727811
Warning           -0.5462693     -1.210128           -0.7197438
         DistrictPROVIDENCE DistrictSPRINGFIELD DistrictSULLY
Citation          -2.389145           0.3690253     0.1267567
Warning           -2.237610           0.1084139    -0.1961090
         DistrictUnverified EthnicityB EthnicityH EthnicityN EthnicityU
Citation         -0.7239367   2.511770  -4.582736  -3.813774  -2.729531
Warning          -1.6738146  -2.361734   3.525458   4.685802   5.843154

Std. Errors:
         (Intercept)      RaceB     RaceI     RaceU      RaceW    GenderM
Citation  0.03690439 0.03664586 0.2797341 0.1046626 0.03631312 0.01796448
Warning   0.04097933 0.04157964 0.2865267 0.1097935 0.04063792 0.02044004
              GenderO   GenderU   GenderX DistrictDRANESVILLE DistrictFRANCONIA
Citation 1.384588e-08 0.1736266 0.5231826          0.04893589        0.03673167
Warning  1.161807e-09 0.1736270 0.5231557          0.05426427        0.04186914
         DistrictHUNTER MILL DistrictMASON DistrictMOUNT VERNON
Citation          0.04137716    0.03725741           0.04078278
Warning           0.04710735    0.04304069           0.04551201
         DistrictPROVIDENCE DistrictSPRINGFIELD DistrictSULLY
Citation         0.03681733          0.04456369    0.03906339
Warning          0.04385473          0.05022441    0.04459307
         DistrictUnverified   EthnicityB EthnicityH EthnicityN EthnicityU
Citation         0.07127717 9.699283e-08 0.02127470 0.01745390 0.03459567
Warning          0.10481264 9.677125e-08 0.02480225 0.01935154 0.03690519

Residual Deviance: 213967.8 
AIC: 214055.8 

Performing multinomial logistic regression shows that enforcement outcomes vary systematically across both police districts and demographic groups. Certain districts, such as Providence and Sully, have higher relative odds of arrest compared to citations or warnings. Race and ethnicity are also significant predictors: Black and Hispanic individuals are more likely to be arrested rather than receive less severe enforcement actions. Gender has smaller but detectable effects. These results indicate that enforcement outcomes are influenced by both location and demographic characteristics.

Conclusion

References